import request from '@/utils/request';
import { Advertise } from './model';

const prefix = '/marketing/advertise';

export async function queryList(): Promise<Advertise[]> {
  return request(prefix);
}

export async function addList(data: FormData): Promise<Advertise> {
  return request(`${prefix}/create`, {
    method: 'POST',
    data,
  });
}

export async function updateList(data: Advertise): Promise<number> {
  return request(`${prefix}/${data.id}`, {
    method: 'PUT',
    data,
  });
}

export async function removeList(id: number): Promise<number> {
  return request(`${prefix}/${id}`, {
    method: 'DELETE',
  });
}
